Skip to content

fix: restore DevTools client styling under Vite 8 environment builds - #1088

Open
antfubot wants to merge 1 commit into
nuxt:mainfrom
antfubot:fix/unocss-vite8-css-post-outdir
Open

fix: restore DevTools client styling under Vite 8 environment builds#1088
antfubot wants to merge 1 commit into
nuxt:mainfrom
antfubot:fix/unocss-vite8-css-post-outdir

Conversation

@antfubot

@antfubot antfubot commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Problem

The DevTools client UI renders completely unstyled (serif fallback font, full-size logo, no sidebar layout) on the latest published alpha and on main. The built client ships none of its UnoCSS utility classes — only the static @unocss/reset survives, so every layout/spacing/color/font utility (flex, grid, fixed, w-screen, bg-base, font-sans, …) is missing.

Root cause

UnoCSS's global build plugin (@unocss/vite) registers Vite's vite:css-post handler keyed by the output directory, building that key set in configResolved from the top-level config.build.outDir (which under Nuxt is the default "dist").

Vite 8's Environment API, however, builds each environment into its own build.outDir — the client goes to .output/public. At renderChunk, options.dir is that per-environment dir, which is never in UnoCSS's key set, so the lookup misses:

[unocss] failed to find vite:css-post plugin

With no css-post handler found, the freshly generated utility CSS (all ~12.7k tokens) is silently dropped and only the statically-imported reset remains.

This is an upstream @unocss/vite ↔ Vite 8 (multi-environment build) incompatibility; it surfaced once the client moved to the Vite 8 / environment build.

Fix

pnpm patch on @unocss/vite@66.10.0 that also registers css-post for each environment's build.outDir, in addition to the top-level one. Registered via patchedDependencies (same mechanism already used for the nitro patch).

Dev mode (nuxi dev client) is unaffected — the patched path is apply: "build" only.

Verification

Rebuilding the client (nuxi generate client):

  • Before: entry.css ≈ 10 KB, no utilities present.
  • After: entry.css = 173 KB, all utilities present and bg-base/n-bg-base shortcuts resolved.

Follow-up

This should be reported/fixed upstream in UnoCSS; the patch is a stopgap pinned to 66.10.0 and will need refreshing on the next bump.

This PR was created with the help of an agent.

The client UI shipped without any UnoCSS utility classes, leaving the
whole app unstyled. UnoCSS's global build plugin registers Vite's
`vite:css-post` handler keyed by the top-level `build.outDir`, but Vite
8's Environment API builds the client into a per-environment output dir
(`.output/public`). The lookup missed, so the generated utility CSS was
silently dropped and only the static reset survived.

Patch `@unocss/vite` to also register css-post for each environment's
`build.outDir`.
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 604b257c-51b5-408a-ba1f-f3f9ba2cc0e3

📥 Commits

Reviewing files that changed from the base of the PR and between 3f4afb2 and b93247b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • patches/@unocss__vite@66.10.0.patch
  • pnpm-workspace.yaml

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

GlobalModeBuildPlugin now includes each Vite environment’s resolved build.outDir in CSS post-processing directory lookup. The workspace configuration applies this patch to @unocss/vite@66.10.0.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to b9324

Environment-specific Vite build outputs now receive UnoCSS post-processing, restoring generated DevTools client utility styling with no identified remaining merge risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the missing DevTools styling, the Vite 8 and UnoCSS root cause, the patch, and verification results.
Title check ✅ Passed The title clearly and concisely identifies the primary change: restoring DevTools client styling for Vite 8 environment builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant